import request from '@/utils/request';

export async function login(data: { email: string; password: string }) {
  return request('/auth/login', {
    method: 'POST',
    data,
  });
}

export async function getAccountInfo() {
  return request('/user');
}

export async function logout() {
  return request.post('/auth/logout');
}

export async function getUserList(params) {
  return request('/admin/users', { params });
}

export async function switchUserStatus(uid) {
  return request.patch(`/admin/users/${uid}/lock`);
}

export async function addUser(params) {
  return request.post('/admin/users', { params });
}

export async function editUser(uid: string | number, params) {
  return request.put(`/admin/users/${uid}`, { params });
}
